/*
   Playing around in C++
   Implementing Euclidean Algorithm
   @Author: George Elias Ferreira da Silva
   @Date: 10/14/2011
*/

#include <iostream>
#include <algorithm>

int gcd (int numA, int numB) {
    int reminder = std::max(numA, numB) % std::min(numA, numB);
    if (reminder != 0)
        return gcd(std::min(numA, numB), reminder);
    return std::min(numA, numB);
}

int main (int argc, const char* argv[]) {
      if (argc != 3) {
          std::cout << "Please, enter only two integral numbers." << std::endl;
          return 0;
        }
        int numA = atoi(argv[1]);
        int numB = atoi(argv[2]);
        std::cout << "GCD is: " << gcd(numA, numB) << std::endl;
    return 0;
}
